function getStrAttr(str, prop,tag) {
    //tag为可选参数,默认匹配所有标签,否则匹配指定标签
    tag=tag || ''
    var patt = new RegExp('(<'+tag+'.*?)' + prop + '=(\"|\')(.*?)(\"|\').*?>', "ig");
    var arr = []
    str.replace(patt, function ($0,$1, $2, $3) {
        arr.push($3)
    })
    return arr
}
var aa='阿斯达岁的<img asd="asd" SRc="a.jpg" alt="阿萨德" /><img src="b.jpg" alt="飞过海"  >阿斯达萨<div src="asd">asd</div>达萨的'
console.log(getStrAttr(aa,'src'))//["a.jpg", "b.jpg", "asd"]
console.log(getStrAttr(aa,'src','img'))//["a.jpg", "b.jpg" ]
console.log(getStrAttr(aa,'src','div'))//["asd"]